package controllers.bluehat;

import java.util.List;

import utils.table.DataTable;
import utils.table.DataTable.DataTablesParameters;

import models.Focus;
import models.User;

public class Dashboard extends BlueHatBaseController {
	/**
	 * Renders the list of the focuses created by the current user (BlueHat).
	 */
	public static void index() {
		render();
	}
	
	/**
	 * Renders the list of the focuses created by the current user (BlueHat).
	 */
	public static void focuses() {
		User user = getCurrentUser();
		List<Focus> focuses = Focus.getByOwner(user);
		render(focuses);
	}
	
	public static void focuses_table() {
		final DataTablesParameters dtp = new DataTable.DataTablesParameters(request);
		DataTable<Focus> table = new DataTable<Focus>(Focus.all().filter("owner", getCurrentUser()), dtp);
		
		renderJSON(table);
	}
}
